import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * Created with Intellij JDEA
 * Description:
 * User:
 * Date:2022-06-03
 * Time:19:43
 */
public class 收件人列表 {
    public static boolean hasComma(String str) {
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == ',' || str.charAt(i) == ' ') {
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            in.nextLine();
            String[] name = new String[n];
            Map<Integer, Boolean> map = new HashMap<>();
            for (int i = 0; i < n; i++) {
                name[i] = in.nextLine();
                map.put(i, hasComma(name[i]));
            }
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < n; i++) {
                if (!map.get(i)) {
                    sb.append(name[i]);
                } else {
                    sb.append('\"');
                    sb.append(name[i]);
                    sb.append('\"');
                }
                if (i != n - 1) {
                    sb.append(',');
                    sb.append(' ');
                }
            }
            System.out.println(sb.toString());
        }
    }

}